
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright"
	content="All Rights Reserved, Copyright (C) 2013, Wuyeguo, Ltd." />
<title>CRM后台管理系统</title>
<script src="js/global1.js" type="text/javascript" charset="utf-8"></script>
</head>
<body class="easyui-layout">

	<div class="easyui-layout" id="wai" style=" width: 1000px; height: 1000px;"data-options="fit:true">
			<div data-options="region:'north',title:'头部CRM后台管理系统 '" style="height: 95px;">
				<h2 style="float:left" class="tips" ></h2>
				
				<h2 style="float:right">你好:<div id="dlm"></div> &ensp;<a href="javascript:void(0)" onclick="sess()"  >退出</a> </h2> 
				<h1 style="text-align:center">CRM后台管理系统</h1>
				
			</div>
			<div data-options="region:'south',title:'底部'" style="height: 60px;">
			
			
			
			</div>
			 <div data-options="region:'east',iconCls:'icon-reload',title:'东',split:true" style="width:220px;">
			 <a href="javascript:void(0)" title="修改密码记得重新登陆呦." onclick="xiugai()"class="easyui-tooltip">修改密码</a>
			 <div id="xiugaip" class="easyui-window" title="修改密码" style="width: 400px; height: 200px" data-options="title:'编辑窗口',closed:true,modal:true">
				<form id="xiugaiform" class="easyui-form" action="register.action" method="post" onsubmit="return validatePass();">
				    <table>
				       <tr>
							<td>原密码:</td>
							<td><!-- <input type="password" class="easyui-textbox" id="upassword1"
								name="upassword" /> -->
								<input id="upassword1" type="password" name="upassword" class="easyui-validatebox" data-options="required:true,validType:'upassword1'" />  				
								</td>
						</tr>
						<tr>
							<td>新密码:</td>
							<td><!-- <input type="password" class="easyui-textbox" id="upasswordX"
								name="upassword" /> -->
								<input required="true" data-options="validType:'length[4,6]'" name="upassword" id="upasswordX" type="password" class="txt01 easyui-validatebox" />
								</td>
						</tr>
						<tr>
							<td>确认密码:</td>
							<td><!--  <input type="password" class="easyui-textbox" id="upasswordQ"
								name="upassword" /> -->
								<a href="#" title="要和你的新密码一样哦." class="easyui-tooltip">
								<input type="password" class="txt01 easyui-textbox" id="upasswordQ"
								name="upassword" data-options="required:true" />
								
								</a>
								</td>
						</tr>
						
				    </table>
				    <a href="javascript:void(0)" type="button" class="easyui-linkbutton" icon="icon-ok" onclick="upmiOK()">确定修改</a>
					<a href="javascript:void(0)" type="button" class="easyui-linkbutton" icon="icon-cancel" onclick="upmino()">取消</a>
					
					
					
				</form>
				</div>
				
				<div class="tixing"></div>
				<div class="xinxi">
				<table id="dg"></table>  
				
				</div>
			 </div>   
			<div data-options="region:'west',title:'导航'" style="width: 150px;">
				<ul id="shu" class="easyui-tree">
				
				</ul>
			</div>
			<div data-options="region:'center',title:'学生数据管理'">
			
				<div id="tt" class="easyui-tabs" > 
             		
            	</div>
			</div>
		</div>
		
		<!--
        	作者：1348946259@qq.com
        	时间：2019-09-20
        	<input  type="hidden"  id="usign" name="usign" value="${list.usign }" />
        	描述：<input  type="hidden"  id="uname" name="uname" value="${list.uname }" />
        -->
</body>
<script type="text/javascript">
	
	var name = globalData.getCurUName();
	$("#dlm").text(name);
	$(function() {
		tixing();
		qingqiandao();
		$("#shu").tree({
			url : globalData.pre+'/testNode',
			method : 'post',
			animate : true,
			queryParams : {
				name : name
			},
			onClick : function(node) {
				var isLeaf = $('#shu').tree('isLeaf', node.target);
				if (isLeaf) {
					Open(node.text, node.path);
				}
			}
			
		});
		function Open(text, url) {
			if ($("#tt").tabs('exists', text)) {
				$('#tt').tabs('select', text);
			} else {
				$('#tt')
						.tabs(
								'add',
								{
									title : text,
									closable : true,
									content : "<iframe src='"
											+ url
											+ ".html' style='width: 100%; height: 600px;'/>"
								});
			}
		}
		qingqiandao();
	});
	function sess(){
		$.post(globalData.pre+"/longin",{
			
		},function(res){
			if (res==1) {
				window.location.href="login.html";
			} 
		})
		
		
	}
	function denglu(){
		window.location.href="main.html";
	}
	function qingqiandao(){
		var uid=globalData.getCurUid();
		var usign=globalData.getCurUSign();
		if (usign==2) {
			$(".tips").html('<a href="javascript:void(0)" onclick="qiandao('+uid+')">请签到</a> ');
			
		} else {
			$(".tips").html('<a href="javascript:void(0)" onclick="qiantui('+uid+')" >已签到</a> ');
		}
	}
	function qiandao(uid){
		
		$.post(globalData.pre+"/updateUser",{
			uid:uid,
			uname:$("#uname").val(),
			usign:1
		},function(res){
			if (res==1) {
			alert("签到成功！！")
			$(".tips").html('<a href="javascript:void(0)" onclick="qiantui('+uid+')" >已签到</a> ');
			
			} 
		})
	}
	function qiantui(uid){
		var date=getDateTimeStr1();
		if (date>190000) {
			$.post(globalData.pre+"/updateQiandao",{
				uid:uid,
				sui:1
			},function(res){
				if (res>0) {
					alert("签退成功！！")
					$(".tips").html("");
					
				} else {
					alert("还是不让你签退了")
					$(".tips").html('<a href="javascript:void(0)" onclick="qiantui('+uid+')" >已签到</a> ');
					
				}
			},"json")
		} else {
			alert("时间未到，真的要签退吗？");
			$.post(globalData.pre+"/updateQiandao",{
				uid:uid,
				sui:2
			},function(res){
				if (res>0) {
					$.post(globalData.pre+"/updateUser",{
						uid:uid,
						uname:$("#uname").val(),
						usign:2
					},function(res){
						if (res==1) {
						alert("签退成功！！")
						$(".tips").html("");
						
						}else{
							alert("还是不让你签退了")
							$(".tips").html('<a href="javascript:void(0)" onclick="qiantui('+uid+')" >已签到</a> ');
							
						} 
					})
				}else{
					alert(res)
				}
			},"json")
		}
		
	}
	 function xiugai(){
			var uid=globalData.getCurUid();
			
			$('#xiugaip').window('open');
		}
	 function upmiOK(){
			var uid=globalData.getCurUid();
			
				upassword1= $("#upassword1").val();
				upassword2= $("#upasswordX").val();
				upassword3= $("#upasswordQ").val();
				
				 if(upassword1==upassword2){
					/* alert("原密码与新密码相同，修改失败"); */
					 $.messager.alert("提示", "原密码与新密码相同，修改失败"); 
					 
					
				} else if(upassword2==upassword3){
					$.post(globalData.pre+"/xiugai",{
						uid:uid,
						upassword:upassword2
					},function(res){
						if(res > 0){
							/* alert("修改成功,请重新登录"); */
							 $.messager.alert("提示", "修改成功,请重新登录"); 
							sess();
						} else{
							$('#xiugaip').window('close');
						}
					},"json")
				} 
				
				
				 
				else{
					/*  alert("新密码与确认密码不一样，修改失败");  */
					 $.messager.alert("提示", "新密码与确认密码不一样，修改失败"); 
				}
				 
	             
			
	             
		}
				
		function upmino(){
			$('#xiugaip').window('close');
		} 
	
		function tixing(){
			//查询自己拥有学生的动态，不为null显示
			var uid=globalData.getCurUid();
			$.post(globalData.pre+"/selectUserStudentcount",{
				uid:uid
			},function(res){
				if (res>0) {
					$(".tixing").html('<a href="javascript:void(0)" onclick="chakandongtai()"  >你有新的动态提醒</a> ');
				} else {
					$(".tixing").html('');
				}
			},"json")
			
		}
		function getDateTimeStr() {
			var s = "";
			var d = new Date();
			var c = ":";
			s += d.getHours() + c;
			s += d.getMinutes() + c;
			s += d.getSeconds();
			return s;
		}
			
		function getDateTimeStr1() {
			var s = "";
			var d = new Date();
			s += d.getHours();
			s += d.getMinutes();
			s += d.getSeconds();
			return s;
		}

		function chakandongtai(){
			var uid=globalData.getCurUid();
			$(".tixing").html('');
			$('#dg').datagrid({    
			    url:'selectUserStudent',   
			    queryParams: {
					uid:uid
			    	},
			    columns:[[    
			        {field:'sid',title:'学生id',hidden:true},    
			        {field:'sname',title:'学生姓名'},    
			        {field:'stianjia',title:'备注',width:100},    
			        {field:'sdtuname',title:'备注人'}    
			    ]]   ,
			    //单击
			    onClickRow:function(rowIndex,rowData){
			    	var sid=rowData.sid;
			    	$.messager.confirm('确认','您确认想要删除这条记录吗？',function(r){    
					    if (r){    
					    	$.post(globalData.pre+"/updatedeletesid",{
					    		sid:sid
					    	},function(res){
					    		if(res>0){
					    			alert("删除成功")
					    		}else{
					    			alert("删除失败")
					    		}
					    	},"json") 	
					    }    
					})
			    	},
			    //双击
			    onDblClickRow :function(rowIndex,rowData){
			    	
			    	alert(rowData.sname);
			    	}
			});  
		}
</script>
</html>